package day0414;

import java.util.Arrays;

public class Test3 {
    public static String arrayToString(int[] arr) {
        if (arr == null) {
            return "null";
        }
        if (arr.length == 0) {
            return "[]";
        }
        String result = "[";
        for (int i = 0; i < arr.length; i++) {
            result = result.concat(String.valueOf(arr[i]));
        }
        result = result.concat("]");
        return result;
    }

    public static void main(String[] args) {
        int[] arr = {1, 2, 3, 4, 5};
        System.out.println("拼接结果: " + arrayToString(arr));
    }
}    